
import Image from 'next/image';
import React from 'react';

type Props = {
    chatUserName: string,
    lastChatDate: string,
    lastChatMessage: string;
    picurl?: string;
};

const ChatMessageList: React.FC<Props> = ({ chatUserName, lastChatDate, lastChatMessage, picurl = "" }) => {
    return (
        <div className='flex items-center bg-[#EBE9E7] border-[#e1e1e1] border-1 w-full min-h-14 overflow-x-hidden'>

            {picurl ? <Image alt='头像' width={45} height={45} src={picurl} className="shadow-2xl ml-2 max-w-[50px]" /> : <div className='flex justify-center items-center bg-amber-800 ml-2 min-w-[45px] min-h-[45px] font-douyinflex text-white'><span >{chatUserName[0]}</span></div>}
            <div className='flex flex-col mx-2 w-full'>
                <div className='flex justify-between'>
                    <div className='text-sm'>
                        {chatUserName}
                    </div>
                    <div className='text-[#9E9D9D] text-xs'>
                        {lastChatDate}
                    </div>

                </div>
                <div className='text-[#9E9D9D] text-xs'>
                    {lastChatMessage}
                </div>
            </div>
        </div>

    );
};

export default ChatMessageList;
